#pragma once
#include <string>
#include <memory>
#include "MySqlConnector.h"
#include "ConfigReader.h"
#include "UserInfo.h"
#include "tinyxml2.h"


// Class contain all necessary function for server to use
class ServerUtil
{
private:
	// read configuration
	ConfigReader config;
	// server until instance (static implement singleton)
	static std::shared_ptr<ServerUtil>  instance;
private:
	// implement singleton pattern
	ServerUtil();
public:
	// get instance of server utility
	static std::shared_ptr<ServerUtil> getInstance();
	// check if a userName and password is valid( avoid sql injection)
	bool isValidUser(MySql::MySqlConnector& connector, UserInfo& user);
	// get property value base on it's key
	std::string getProperty(std::string key);
	// destructor
	~ServerUtil();
};

